num_states
} state_t;
static state_t state;
-#if __cplusplus
-inline state_t operator++(state_t& rs, int)
+inline state_t& operator++(state_t& s) // prefix
{
- return rs = (state_t)((int)rs + 1);
+ return s = static_cast<state_t>(s + 1);
+}
+inline const state_t operator++(state_t& s, int) // postfix
+{
+ state_t ret(s);
+ s = ++s;
+ return ret;
}
-#endif
static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 };
default:
fatal(MYNAME ": Bad internal state\n");
}
- state++;
+ ++state;
return remaining;
}
unknown_header
} header_type;
-#if __cplusplus
-inline header_type operator++(header_type& rs, int)
+inline header_type& operator++(header_type& s) // prefix
{
- return rs = (header_type)((int)rs + 1);
+ return s = static_cast<header_type>(s + 1);
+}
+inline const header_type operator++(header_type& s, int) // postfix
+{
+ header_type ret(s);
+ s = ++s;
+ return ret;
}
-inline gt_display_modes_e operator++(gt_display_modes_e& rs, int)
+inline gt_display_modes_e& operator++(gt_display_modes_e& s) // prefix
{
- return rs = (gt_display_modes_e)((int)rs + 1);
+ return s = static_cast<gt_display_modes_e>(s + 1);
+}
+inline const gt_display_modes_e operator++(gt_display_modes_e& s, int) // postfix
+{
+ gt_display_modes_e ret(s);
+ s = ++s;
+ return ret;
}
-#endif
#define MAX_HEADER_FIELDS 36
return 0;
}
- for (gt_display_modes_e i = GT_DISPLAY_MODE_MIN; i <= GT_DISPLAY_MODE_MAX; i++) {
+ for (gt_display_modes_e i = GT_DISPLAY_MODE_MIN; i <= GT_DISPLAY_MODE_MAX; ++i) {
if (case_ignore_strcmp(str, gt_display_mode_names[i]) == 0) {
*val = i;
return 1;
static void
garmin_txt_rd_deinit()
{
- for (header_type h = waypt_header; h <= unknown_header; h++) {
+ for (header_type h = waypt_header; h <= unknown_header; ++h) {
free_header(h);
}
gbfclose(fin);
}
typedef enum { id, takeoff, start, turnpoint, finish, landing } state_t;
-#if __cplusplus
-inline state_t operator++(state_t& rs, int)
+inline state_t& operator++(state_t& s) // prefix
{
- return rs = (state_t)((int)rs + 1);
+ return s = static_cast<state_t>(s + 1);
+}
+inline const state_t operator++(state_t& s, int) // postfix
+{
+ state_t ret(s);
+ s = ++s;
+ return ret;
}
-#endif
/**
* Handle pre- or post-flight task declarations.
rte_head->rte_name = task_num;
rte_head->rte_desc = QStringLiteral(DATEMAGIC) + flight_date + QStringLiteral(": ") + task_desc;
route_add_head(rte_head);
- state++;
+ ++state;
return;
}
// Get the waypoint
switch (state) {
case takeoff:
snprintf(short_name, 8, "TAKEOFF");
- state++;
+ ++state;
break;
case start:
snprintf(short_name, 8, "START");
tp_ct = 0;
- state++;
+ ++state;
break;
case turnpoint:
if (++tp_ct == num_tp) {
- state++;
+ ++state;
}
snprintf(short_name, 8, "TURN%02u", tp_ct);
break;
case finish:
snprintf(short_name, 8, "FINISH");
- state++;
+ ++state;
break;
case landing: